import logging

import pytest

from resource.pom.launcher import Launcher
from resource.pom.system_ui import SystemUI


class Test:
    system_ui = SystemUI

    @pytest.mark.parametrize('setup_teardown', [None], indirect=True)
    def test(self, setup_teardown, device):
        logging.info('步骤1、从屏幕左上角下滑')
        device.dropdown_notification_bar()
        logging.info('预期结果1、正常下滑拉扯通知中心')
        device.assert_current_window(Launcher.systemui_dropdownpan)
        device.refresh_layout()
        device.assert_text_exist('没有通知')

        logging.info('步骤2、点击设置图标按钮')
        device.click(*self.system_ui.notification_bar_settings)
        device.wait(1)
        logging.info('预期结果2、跳转通知中心页面，界面展示完整，通知中心开启关闭按钮保存生效')
        device.assert_current_window(Launcher.systemui)
        device.refresh_layout()
        device.assert_text_exist('通知管理')
